home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-08-19 | 4.3 KB | 102 lines | [TEXT/ttxt] |
- function IconListDispatch selector,listHandle,param2,param3
- if listhandle="0" then return "Error"
- if listhandle= "I can't use that rectangle! It's too small for even 1 icon!" then return "Error"
- if selector = "1" or selector = "new" then return newList(param2,param3)
- else if listhandle = "" then return "Error"
- else if selector="2" or selector = "draw" then return drawList(listHandle)
- else if selector = "3" or selector = "setScroll" then return ss(listHandle,param2)
- else if selector = "4" or selector = "kill" then return kill(listHandle)
- else if selector = "5" or slector = "getScroll" then return listHandle@@.longIntType[3]
- else if selector = "6" or selector = "getnumonline" then return listHandle@@.longIntType[4]
- else if selector = "7" or selector = "getnumlineonscreen" then return listHandle@@.longIntType[5]
- else if selector = "8" or selector = "getlinecount" then return listHandle@@.longIntType[6]
- else if selector = "9" or selector = "getnumicons" then return listHandle@@.longIntType[7]
- else if selector = "10" or selector = "getrect" then return listHandle@@.integertype[2] & "," & listHandle@@.integertype[1] & "," & listHandle@@.integertype[4] & "," & listHandle@@.integertype[3]
- end IconListDispatch
-
- --type myHandle
- --listRect rectangle 8 myHandle@@.longIntType[1]..myHandle@@.longIntType[2]
- --scroll LongInt 4 myHandle@@.longIntType[3]
- --NumOnLine LongInt 4 myHandle@@.longIntType[4]
- --NumLinesVis LongInt 4 myHandle@@.longIntType[5]
- --NumLines LongInt 4 myHandle@@.longIntType[6]
- --iconCount LongInt 4 myHandle@@.longIntType[7]
- --iconHandles array of LongInt[1..iconCount] iconCount*4
-
- function kill myHandle
- put myHandle@@.longIntType[7] into j
- repeat with g = 1 to j
- disposhandle myHandle@@.longIntType[j+7]
- end repeat
- disposhandle myhandle
- end kill
-
- function ss myHandle,news
- put news into myHandle@@.longIntType[3]
- end ss
-
- global l1:L,l2:L,temp:R
- function drawlist myHandle
- put myHandle@@.longIntType[1] into l1
- put myHandle@@.longIntType[2] into l2
- put l1.integertype[2] into r1
- put l1.integertype[1] into r2
- put l2.integertype[2] into r3
- put l2.integertype[1] into r4
- put myHandle@@.longIntType[3] into scroll
- put myHandle@@.longIntType[4] into numonline
- put myHandle@@.longIntType[5] into numlinevis
- put myHandle@@.longIntType[6] into numlines
- put myHandle@@.longIntType[7] into iconcount
- put (scroll*numonline)+1 into startat
- put 34 into size1
- repeat min(numlinevis,numlines)
- repeat min(numonline,iconcount)
- if startat>Iconcount then exit repeat -- ΔΔΔΔΔΔΔΔΔΔΔΔΔΔΔΔΔVERY VERY IMPORTANT.
- setrect temp r1,r2,r1+32,r2+32
- plotIcon temp,myHandle@@.longIntType[startat+7]
- add size1 to r1
- add 1 to startat
- end repeat
- put l1.integertype[2] into r1
- add size1 to r2
- end repeat
- end drawlist
-
- function newList icons,ListRect
- put the number of items in icons*4 into j -- space for icons' handles
- add 4 to j -- space for icon count
- add 8 to j -- space for rectangle
- add 4 to j -- space for scroll
- add 4 to j -- space for number of lines
- add 4 to j -- number on 1 line
- add 4 to j -- number of lines visible
- put newHandleClear(j) into myHandle
- hlock myhandle
- setRect myHandle@@,item 1 of listrect,item 2 of listrect,item 3 of listrect,item 4 of listrect
- hunlock myHandle
- put 34 into size1
- get (item 3 of listrect-item 1 of listrect) div size1
- if it = 0 then
- disposHandle myHandle
- return "I can't use that rectangle! It's too small for even 1 icon!"
- end if
- put it into myHandle@@.longIntType[4] -- num on line
- if ((item 4 of listrect-item 2 of listrect) div size1) = 0 then
- disposHandle myHandle
- return "I can't use that rectangle! It's too small for even 1 icon!"
- end if
- put ((item 4 of listrect-item 2 of listrect) div size1) into myHandle@@.longIntType[5]
- put the number of items in icons*1 into ni
- if ni mod it ≠0 then
- put (ni div it)+1 into myHandle@@.longIntType[6]
- else put ni div it into myHandle@@.longIntType[6]
- put ni into myHandle@@.longIntType[7]
- -- now to load the icons
- repeat with nowOn = 1 to ni
- get GetIcon(item nowOn of icons)
- detachresource it -- if hypercard loads the icon, it won't touch my copy
- put it into myHandle@@.longIntType[7+nowOn]
- end repeat
- return myHandle
- end newList